package com.jiji.miaosha.service.model;

import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

@Data
public class ItemModel {

    private Integer id;//商品ID
    @NotBlank(message = "商品名称不能为空")
    private String title;//商品名称

    //不为空则表示其还有未结束的秒杀活动
    private PromoModel promoModel;

    @NotNull(message = "商品价格不能为空")
    @Min(value = 0, message = "商品价格必须大于0")
    private BigDecimal price;//商品价格

    @NotNull(message = "商品库存不可不填写")
    private Integer stock;//商品库存

    @NotBlank(message = "商品描述信息不能为空")
    private String description;//商品描述

    private Integer sales;//商品销量

    @NotNull(message = "商品图片信息不能为空")
    private String imgUrl;//商品图片的URL
}
